package com.qf10;

import java.util.concurrent.ArrayBlockingQueue;

public class Demo6 {
    public static void main(String[] args) throws InterruptedException {
        //1.创建有界队列,添加数据
        ArrayBlockingQueue<String> queue=new ArrayBlockingQueue<>(5);
        queue.put("aaa");
        queue.put("bbb");
        queue.put("ccc");
        queue.put("ddd");
        queue.put("eee");
        System.out.println("已经添加了5个元素");
        //删除元素
        queue.take();
        queue.put("xyz");
        System.out.println("已经添加了6个元素");
        System.out.println(queue.toString());
    }
}
